// Copyright 2013 Square, Inc.
package org.assertj.ohos.api.widget;

import ohos.agp.components.TimePicker;
import org.assertj.ohos.api.view.AbstractViewGroupAssert;
import static org.assertj.core.api.Assertions.assertThat;

public class TimePickerAssert extends AbstractViewGroupAssert<TimePickerAssert, TimePicker> {
  public TimePickerAssert(TimePicker actual) {
    super(actual, TimePickerAssert.class);
  }

  public TimePickerAssert hasCurrentHour(Integer hour) {
    isNotNull();
    Integer actualHour = actual.getHour();
    assertThat(actualHour) //
        .overridingErrorMessage("Expected current hour <%s> but was <%s>.", hour, actualHour) //
        .isEqualTo(hour);
    return this;
  }

  public TimePickerAssert hasCurrentMinute(Integer minute) {
    isNotNull();
    Integer actualMinute = actual.getMinute();
    assertThat(actualMinute) //
        .overridingErrorMessage("Expected current minute <%s> but was <%s>.", minute,
            actualMinute) //
        .isEqualTo(minute);
    return this;
  }

  public TimePickerAssert hasHour(int hour) {
    isNotNull();
    int actualHour = actual.getHour();
    assertThat(actualHour) //
        .overridingErrorMessage("Expected hour <%s> but was <%s>.", hour,
            actualHour) //
        .isEqualTo(hour);
    return this;
  }

  public TimePickerAssert hasMinute(int minute) {
    isNotNull();
    int actualMinute = actual.getMinute();
    assertThat(actualMinute)
        .overridingErrorMessage("Expected minute <%s> but was <%s>.", minute,
            actualMinute) //
        .isEqualTo(minute);
    return this;
  }

  public TimePickerAssert isIn24HourView() {
    isNotNull();
    assertThat(actual.is24Hour()) //
        .overridingErrorMessage("Expected to be in 24 hour view but was not.") //
        .isTrue();
    return this;
  }

  public TimePickerAssert isNotIn24HourView() {
    isNotNull();
    assertThat(actual.is24Hour()) //
        .overridingErrorMessage("Expected to not be in 24 hour view but was.") //
        .isFalse();
    return this;
  }
}
